package com.zhidisoft.crm.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhidisoft.crm.dao.CustomerPoolMapper;
import com.zhidisoft.crm.service.CustomerPoolService;
import com.zhidisoft.crm.vo.PageVo;
@Service
@Transactional
public class CustomerPoolImpl implements CustomerPoolService {

	@Autowired
	CustomerPoolMapper dao;
	
	@Override
	public PageVo pageList(Integer pageNum, Integer pageSize) {
		PageVo pageVo = new PageVo();
		pageVo.setPageNum(pageNum);
		pageVo.setPageSize(pageSize);
		int beginIndex = (pageNum - 1) * pageSize;
		int endIndex = beginIndex + pageSize;
		pageVo.setList(dao.pageList(beginIndex, endIndex));
		//pageVo.setList(dao.pageList((pageNum - 1) * pageSize, pageSize));
		pageVo.setTotalCount((int) dao.totalCount());
		return pageVo;
	}

}
